package com.itheima.a04polymorphismdemo4;

public class Test3 {
    public static void main(String[] args) {
        //创建对象并调用方法
//        Person keeper1 = new Person(30,"老王");
//        Dog dog = new Dog(2,"黑");
//        keeper1.keepPet(dog,"骨头");
//
//        Person keeper2 = new Person(25,"老李");
//        Cat cat = new Cat(3,"灰");
//        keeper2.keepPet(cat,"鱼");

        //创建饲养员的对象
        Person keeper = new Person();
        Dog dog = new Dog(2,"黑");
        Cat cat = new Cat(3,"灰");
        keeper.keepPet(dog,"骨头");
        keeper.keepPet(cat,"鱼");
    }
}
